﻿using netDxf;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestDxfDocument

{

    class ISYC_306_09
    {
        //图F.67  ISYC 306-09-可转位刀片和安装实心钻、延伸阶梯钻
        public static void ISYC_306_09_g(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中性线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //基本参数-------------------------------------------------------------------------------------------------
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            //赋值参数--------------------------------------------------------------------------------------------------
   
            double scale = Convert.ToDouble(data["scale"]);
         //    double sl_ = 150;
         //    double scale = 1;
           /*
            double dconms = 20 * scale;
            double dconws = 11.28 * scale;
            double df = 42.7 * scale;
            double bd = 28.34 * scale;
            double dc = 31.984 * scale;
            double pl = 7.43 * scale;
            double lu = 17.53 * scale;
            double lcf = 24.65 * scale;
            double lpr = 38.79 * scale;
            double lf_2 = 31.366 * scale;
            double oal = 57.32 * scale;
            double lscws = 29.67 * scale;
            double lf_1 = 38.1 * scale;
            double ls = 18.53 * scale;
            */
            
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dconws = Convert.ToDouble(data["dconws"]) * scale;
            double df = Convert.ToDouble(data["df"]) * scale;
            double bd = Convert.ToDouble(data["bd"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double pl = Convert.ToDouble(data["pl"]) * scale;
            double lu = Convert.ToDouble(data["lu"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double lpr = Convert.ToDouble(data["lpr"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double lscws = Convert.ToDouble(data["lscws"]) * scale;
            double lf_1 = Convert.ToDouble(data["lf_1"]) * scale;
            double ls = Convert.ToDouble(data["ls"]) * scale;

            double dy =pl*(0.64/7.43);//p1到三角缺的一部分
            double dy1 = dc*(1.31/31.984);//三角顶部bd与dc相减缺的一部分
            double dy2 = pl*(0.6353/7.43) * scale;//p7到p12的距离
            double dy3 = lpr*(3.13/38.79) * scale;//刀柄头厚度
            double xj = 57;//刀柄斜角
            double xj_ = xj * pi / 180;

            //点---------------------------------------------------------------------------------------------
            //第一部分
            //切削部分
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, oal);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1_1 = fun.Polar(p0, 0, dy);
            Vector2 p1 = fun.Polar(p1_1, pi / 2, dconws / 2.0);
            Vector2 p2 = fun.Polar(p1, pi, pl / 8.0);
            Vector2 p3 = fun.Polar(p2,  53*pi/180, (bd/2.0+dy1 -dconws/2.0 ) / (Math.Sin(53*pi/180)));
            Vector2 p4 = fun.Polar(p3,  -53*pi/180, fun.CalDistance(p2, p3));
            Vector2 p5 = fun.Polar(p1, 0, lscws - dy - (lscws / 31.0));
            Vector2 p6 = fun.Polar(p5, - pi / 4, (lscws / 31.0) / Math.Cos(pi / 4));
            Vector2 p7 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p8= fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p9= fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p10_1 = fun.Polar(p3, pi / -2, dy1);
            Vector2 p10_2 = fun.Polar(p10_1, 0, oal);
            Vector2 p10 = fun.Inters(p10_1, p10_2, p3, p4);
            Vector2 p11 = new Vector2(lcf, bd / 2.0);
            Vector2 p12 = fun.Polar(p7, pi, dy2);
            Vector2 p13_1 = fun.Polar(p0_1, pi / -2, dc - p3.Y);
            Vector2 p13_2 = fun.Polar(p13_1, pi, oal*1.5);
            Vector2 p13 = fun.Inters (p13_1, p13_2, p12, fun.Polar(p12, -xj_, oal));
            Vector2 p14_1 = fun.Polar(p0_1, pi / -2, bd / 2.0);
            Vector2 p14_2 = fun.Polar(p14_1, pi, oal * 1.5);
            Vector2 p14 = fun.Inters(p14_1, p14_2, p7, fun.Polar(p7, -xj_, oal));
            Vector2 p15_1 = fun.Polar(p12, 0, lf_1);
            Vector2 p15_2 = fun.Polar(p15_1, pi / -2, oal);
            Vector2 p15 = fun.Inters (p15_1, p15_2, p14, fun.Polar(p14, 0, oal));
            Vector2 p16 = fun.Inters(p14, p15, p13, fun.Polar(p13, 61 * pi / 180, oal));
            Vector2 p17 = fun.Polar(p15_1, pi / 2, dconws);
            double fz1 = lf_1 - lscws - dy3;
            Vector2 p18 = fun.Polar(p17, pi-10 * pi / 180, ((fz1 - fz1 / 3.0) / 3.0) / Math.Cos(20 * pi / 180)) ;
            Vector2 p19=fun .Polar(p18, pi+10 * pi / 180, ((fz1 - fz1 / 3.0) / 3.0) / Math.Cos(20 * pi / 180));
            Vector2 p20=fun .Polar  (p19, pi - 10 * pi / 180, ((fz1 - fz1 / 3.0) / 3.0) / Math.Cos(20 * pi / 180));
            Vector2 p21 = p15_1;
            Vector2 p22 = fun.Polar(p15_1, pi / 2, dconws / 2.0 + df / 2.0);
            Vector2 p23 = fun.Polar(p22, 0, dy3);
            Vector2 p24 = fun.mirrorpoint(p22, p0_1, p0_2);
            Vector2 p25 = fun.mirrorpoint(p23, p0_1, p0_2);
            Vector2 p26_1 = fun.Polar(p23,pi/-2,fun .CalDistance (p23,p25)/2.0);
            Vector2 p26 = fun.Polar(p26_1, pi / 2, dconms/2.0);
            Vector2 p27 = fun.Polar(p26, 0, ls - ls / 8.0);
            Vector2 p28 = fun.Polar(p27, -pi / 4, (ls / 8.0) / Math.Cos(pi / 4));
            Vector2 p29 = fun.mirrorpoint(p26, p0_1, p0_2);
            Vector2 p30= fun.mirrorpoint(p27, p0_1, p0_2);
            Vector2 p31= fun.mirrorpoint(p28, p0_1, p0_2);
            Vector2 p32 = fun.Polar(p3, pi / -2, fun.CalDistance(p3, p4) / 4.0);
            Vector2 p33 = fun.Polar(p4,pi-53/2*pi/180,fun .CalDistance (p3,p4)/4.0);
            Vector2 p34 = fun.Polar(p2, 53 / 2 * pi / 180, fun.CalDistance(p3, p4) / 4.0) ;

            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p7, p8, p9, p6, p5, p8, p5, p2, p3,p10,p11, p4,p3);
            var polyline2 = Pus.AddPointsToLwPolyLine(p16, p14, p7, p12, p13, p16, p15, p17, p18, p19, p20, p5);
            var polyline3 = Pus.AddPointsToLwPolyLine(p26, p23, p22, p24, p25, p26, p27, p28, p31, p30, p27, p30, p29);
            var polyline4 = Pus.AddPointsToLwPolyLine(p5, p20, p19, p18, p17, p15, p14, p7, p8, p9, p6, p5);
            var polyline9 = Pus.AddPointsToLwPolyLine(p32, p33, p34, p32);
            polyline1.Vertexes[11].Bulge = -Math.Tan((86*pi/180) / 4);
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline4.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline4.Explode()[i].Type.ToString();    //将所有元素的类型记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline4.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline4.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 135, 10*scale, hline1, harc1, hatching);
           
            
            
            
            void vis(Vector2 p,Vector2 pp)
            {
                oal = 43.72 * scale;
                Vector2 pp1 = fun.Polar(p, -pi / 2,(p.Y -pp.Y )/ 2.0);
                Vector2 pp2 = fun.Polar(pp1, pi / 2, dconws/2.0+dconws /8.0);
                Vector2 pp3 = fun.Polar(pp2, pi, oal);
                Vector2 pp4 = fun.mirrorpoint(pp2, p0_1, p0_2);
                Vector2 pp5 = fun.mirrorpoint(pp3, p0_1, p0_2);
                Vector2 pp6 = fun.Inters(pp2, pp3, p, fun.Polar(p, pi - pi / 4, oal));
                Vector2 pp7 = fun.Inters(pp4, pp5, pp, fun.Polar(pp, pi + pi / 4, oal));
                Vector2 pp8 = fun.Inters (pp6, pp7, p0_1, p0_2);
                Vector2 pp9 = fun.Polar(pp8, pi / 2, dconws / 6.0);
                Vector2 pp10 = fun.Polar(pp7, pi / 2, fun.CalDistance(pp8, pp9));
                Vector2 fk1 = fun.Polar(pp2, pi / 2, 0.1);
                Vector2 fk2 = fun.Polar(fk1, pi, oal);
                Vector2 fk3 = fun.mirrorpoint(fk1, p0_1, p0_2);
                Vector2 fk4 = fun.mirrorpoint(fk2, p0_1, p0_2);
                Vector2 pp11 = fun.Inters(p0_1, p0_2, pp9, fun.Polar(pp9, 44 * pi / 180, oal));
                Vector2 pp12 = fun.Inters(pp11, fun.Polar(pp11, -150 * pi / 180, oal), pp4, pp5);
                Vector2 pp13 = fun.Inters(p0_1, p0_2, pp6, fun.Polar(pp6, -156 * pi / 180, oal));
                Arc arc1 = fun.DrawArc5(pp6, new Line(fk1, fk2), pp13);
                Vector2 pp14 = fun.Inters1(pp12, fun.Polar(pp12, 50 * pi / 180, oal), arc1, 1);
                Vector2 pp15 = fun.Inters(pp14, fun.Polar(pp14, -81 * pi / 180, oal), pp12, fun.Polar(pp12, 39 * pi / 180, oal));
                Arc arc2 = fun.DrawArc5(pp12, new Line(fk3, fk4), pp11);
                Vector2 pp16 = fun.Inters1(pp7, fun.Polar(pp7, 173 * pi / 180, oal), arc2, 1);
                Arc arc3 = fun.DrawArc5(pp16, new Line(fk3, fk4), pp7);
                Vector2 pp18 = fun.Polar(pp1, pi, oal);
                Vector2 pp19 = fun.Inters(pp18, fun.Polar(pp18, 70 * pi / 180, oal), pp2, pp3);
                Vector2 pp20 = fun.Inters(pp18, fun.Polar(pp18, -70 * pi / 180, oal), pp4, pp5);
                Vector2 pp21 = fun.Inters(pp20, fun.Polar(pp20, 54 * pi / 180, oal), pp2, pp3);
                Vector2 pp22 = fun.Inters(pp20, fun.Polar(pp20, pi / 2, oal), pp21, fun.Polar(pp21, -140 * pi / 180, oal));
                Vector2 arc5_1 = fun.Polar(pp21, pi / 2, 0.1);
                Vector2 arc5_2 = fun.Polar(arc5_1, pi + 20 * pi / 180, oal);
                Arc arc5 = fun.DrawArc5(pp21, new Line(arc5_1 ,arc5_2), pp22);
                Vector2 pp23 = fun.Inters1(pp19, fun.Polar(pp19, -15 * pi / 180, oal), arc5, 0);
                Vector2 pp24 = fun.Inters(pp20, fun.Polar(pp20, pi / 6, oal), p0_1, p0_2);
                Vector2 pp25 = fun.Inters1(pp24, fun.Polar(pp24, 17*pi/180, oal), arc1, 0);
                Arc arc6 = fun.DrawArc5(pp20, new Line(fk3, fk4), pp24);
                Arc arc7 = fun.DrawArc5(pp25, new Line(fk1, fk2), pp24);
                Vector2 pp26 = fun.Inters(pp20, fun.Polar(pp20, 34 * pi / 180, oal), p0_1, p0_2);
                Vector2 pp27 = fun.Inters1(fun .Polar (pp21,pi/-2,0.2-0.2326), fun.Polar(fun.Polar(pp21, pi / -2, 0.1), 0, oal), arc7, 0);
                Vector2 pp28 = fun.Inters1(pp13, fun.Polar(pp13, -161 * pi / 180, oal), arc6, 1);
                Arc arc4 = fun.DrawArc5(pp28, new Line(fk3, fk4), pp13);
                Vector2 pp17 = fun.Inters1(fun .Polar (pp12,pi/2,0.2-0.2326+0.06), fun.Polar(fun.Polar(pp12, pi / 2, 0.2 - 0.2326), 180 * pi / 180, oal), arc4 , 1);

                var polyline5 = Pus.AddPointsToLwPolyLine(pp11,pp9, pp10, pp7, pp, p, pp6, pp9);
                polyline5.Vertexes[0].Bulge = -Math.Tan((47 * pi / 180) / 4);
                polyline5.Vertexes[1].Bulge = -Math.Tan((50 * pi / 180) / 4);
                var polyline6 = Pus.AddPointsToLwPolyLine(pp17, pp12, pp15, pp14);
                polyline6.Vertexes[1].Bulge = Math.Tan((81 * pi / 180) / 4);
                polyline6.Vertexes[2].Bulge = Math.Tan((35 * pi / 180) / 4);
                var polyline7 = Pus.AddPointsToLwPolyLine(pp22,pp18,pp19,pp23,pp19,pp18,pp20,pp22);
                polyline7.Vertexes[0].Bulge = -Math.Tan((44 * pi / 180) / 4);
                polyline7.Vertexes[2].Bulge = -Math.Tan((43 * pi / 180) / 4);
                polyline7.Vertexes[3].Bulge = Math.Tan((43 * pi / 180) / 4);
                var polyline8 = Pus.AddPointsToLwPolyLine(pp20, pp26, pp27, pp21);
                polyline8.Vertexes[0].Bulge =  Math.Tan((57 * pi / 180) / 4);
                polyline8.Vertexes[1].Bulge = -Math.Tan((49 * pi / 180) / 4);
                LwPolyline[] n = { polyline5, polyline6, polyline7, polyline8 };
                Arc[] m = { arc1, arc2, arc3, arc4, arc5, arc6, arc7 };
                int i = 0;
                do
                {
                    if (i < 4)
                    {
                        n[i].Layer = additionalline;//Layer指图层
                        n[i].LinetypeScale = 5 * scale;//指线性比例
                        n[i].Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                        m[i].Layer = additionalline;//Layer指图层
                        m[i].LinetypeScale = 5 * scale;//指线性比例
                        m[i].Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                    }
                   else
                    {
                        m[i].Layer = additionalline;//Layer指图层
                        m[i].LinetypeScale = 5 * scale;//指线性比例
                        m[i].Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                    }
                    i++;
                } while (i<7);
                
                dxf.AddEntity(new EntityObject[] {arc1 ,arc2,arc3 ,arc4 ,arc5 ,arc6,arc7
                ,polyline5 ,polyline6 ,polyline7 ,polyline8 ,polyline9 
                });
            }
            vis(p2, p12);
            dxf.AddEntity(new EntityObject[] { polyline1,polyline2 ,polyline3

            });
            Line line1 = new Line(p0_1 , p0_2 );
            line1.Lineweight = Lineweight.W25;//Lineweight指线宽
            line1.Layer = centre;//Layer指图层
            line1.LinetypeScale = 5 * scale ;//指线性比例
            line1.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line1); //提取
            //标注
            /* fun.dimrot1(dxf, p1, p18, 90, dc, 2, 2 * scale, 2.4 * scale, 0.9, "DCB", "", "");
       fun.jdbz2(dxf, new Line(p4, p5), new Line(p7, p8), dc, 2 * scale, 2.4 * scale, 0.9, "SIG", "", "");
       fun.Axis(dxf, fun.Polar(p0, pi + pi / 3, dc * 2), 180, -90, "Z", "X", "Y", 1 * scale, 2 * scale, 0);
       fun.Axis(dxf, p0, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
       fun.Axis(dxf, p19, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
       fun.Singlelinearrow(dxf, "CCMS", v1, 110, fun.Polar(v1, 110 * pi / 180, dc / 2.0), fun.Polar(v1, 110 * pi / 180, dc), 1.2 * scale, 1.6 * scale);
       Text txt1 = new Text("PCS", v18, 2.2 *scale , 0);
       Circle circle1 = new Circle(p0, 1.7 * 2 * scale) ;
             */
            Vector2 v1 = fun.Inters(p3, fun.Polar(p3, pi / -2, oal), p4, fun.Polar(p4, pi - 53 / 2 * pi / 180, oal));
            Vector2 v2 = fun.Polar(p26, 0, fun.CalDistance(p26, p27) / 6.0);
            Vector2 v3 = fun.Polar(p3, pi - pi / 4, dc * 1.3);
            Vector2 v4 = fun.Polar(p3, pi - pi / 4, 0.5 * 1.7 * scale);
            Vector2 v5 = fun.Polar(v4, pi - pi / 4, dc / 2.0);
            Vector2 v6 = fun.Polar(v1, pi - pi / 6, 0.5*1.7*scale );
            Vector2 v7 = fun.Polar(v6, pi - pi / 6, dc );
            Vector2 v8 = fun.Polar(p1_1, pi + pi / 4, 0.5 * 1.7 * scale);
            Vector2 v9 = fun.Polar(v8, pi + pi / 4, dc*1.2);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p14, pi / 2, bd / 5.0);
            Vector2 v12 = fun.Polar(v11, pi + pi / 3, 0.5 * 1.7 * scale);
            Vector2 v13 = fun.Polar(v12, pi + pi / 3, dc );
            Vector2 v14 = fun.Polar(v13, pi / -2, 1.2 * scale);
            Vector2 v15 = fun.Polar(p12, 0, pl / 5.0);
            Vector2 v16 = fun.Polar(p26_1, pi / -3, 0.5 * 1.7 * scale) ;
            Vector2 v17 = fun.Polar(v16, pi / -3, dconms / 1.2);
            Vector2 v18 = fun.Polar(v17, pi / -2, 1.2 * scale);


            fun.dimrot1(dxf, p3, p2, 0, dc/2.0-(p3.Y -p2.Y )/2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "PL,SD_1", "", "");
            fun.dimrot1(dxf, fun .Polar (p2,0,lu ), p2, 0, dc/1.2 - ( p2.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p5, p2, 0, dc  - (p2.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF", "", "");
            fun.dimrot1(dxf, p23, p3, 0, dc *1.2 - (p23.Y - p3.Y) / 2.0-p3.Y , 2, 1.2 * scale, 1.6 * scale, 0.9, "LF_2,LTA_2", "", "");
            fun.dimrot1(dxf, p23, p2, 0, dc * 1.5 - (p23.Y - p2.Y) / 2.0-p2.Y , 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, p28, p2, 0, dc * 1.8 - (p28.Y - p2.Y) / 2.0-p28.Y , 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL", "", "");
            fun.dimrot1(dxf, p9, p12, 180, dc  - (p12.Y - p9.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LSCWS", "", "");
            fun.dimrot1(dxf, p25, p12, 180, dc - (p25.Y - p12.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LF_1,LTA_1", "", "");
            fun.dimrot1(dxf, p25, p31, 180, dc - (p25.Y - p31.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LS", "", "");
            fun.dimrot1(dxf, p10, p14, 90, oal+dc / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "BD", "", "");
            fun.dimrot1(dxf, p3, p13, 90, oal + dc, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p22, p24, 90, oal+lpr  + dc*1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DF", "", "");
            fun.dimrot1(dxf, p27, p30, -90, dc /2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS", "", "");
            fun.Axis(dxf, v1 , 0, 90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, p26_1 , 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, p1_1 , 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, v11 , 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, fun .Polar (p31,pi/-4,dconms ), 0, -90, "Z", "X", "Y", 0.5 * scale, 1.6 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v2, 80, fun.Polar(v2, 80 * pi / 180, dc / 4.0), fun.Polar(v2, 80 * pi / 180, dc/2.0), 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v3, 180, fun.Polar(v3, 0 * pi / 180, dc / 4.0), fun.Polar(v3, 0 * pi / 180, dc/2.0), 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "CCWS", v15, 225, fun.Polar(v15, 225 * pi / 180, dc/2.0 ), fun.Polar(v15, 225 * pi / 180, dc ), 1.2 * scale, 1.6 * scale);
            fun.jdbz2(dxf, new Line(p12, p13), new Line(p2, p3), dc/1.5, 1.2 * scale, 1.6 * scale, 0.9, "SIG", "", "");
            Line linev1 = new Line(v4, v5);
            Line linev2 = new Line(v6, v7);
            Line linev3 = new Line(v8, v9);
            Line linev4 = new Line(v12, v13);
            Line linev5 = new Line(v17, v16);
            Text txt1 = new Text("CRP", v5, 1.2 * scale, 0);
            Text txt2 = new Text("CSW2_1", v7, 1.2 * scale, 0);
            Text txt3 = new Text("CSW1", v10, 1.2 * scale, 0);
            Text txt4 = new Text("CSW2_2", v14, 1.2 * scale, 0);
            Text txt5 = new Text("PCS,MCS", v18, 1.2 * scale, 0);
            Text txt6 = new Text("ISYC=306_09", fun .Polar (p6,pi/2,dc*2), 1.2 * scale, 0);

            Circle circle1 = new Circle(p3, 1.7 * 0.5 * scale);
            Circle circle2 = new Circle(v1, 1.7 * 0.5 * scale);
            Circle circle3 = new Circle(p1_1 , 1.7 * 0.5 * scale);
            Circle circle4 = new Circle(v11 , 1.7 * 0.5 * scale);

            dxf.AddEntity(new EntityObject[] { linev1 ,linev2 ,linev3,linev4,linev5
                ,txt1 ,txt2 ,txt3 ,txt4,txt5 ,txt6
                ,circle1 ,circle2 ,circle3 ,circle4 
 
            });
            //定义格式，根据路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
        }
        //图F.67  ISYC 306-09-可转位刀片和安装实心钻、延伸阶梯钻
        public static void ISYC_306_09_j(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中性线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //基本参数-------------------------------------------------------------------------------------------------
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            //赋值参数--------------------------------------------------------------------------------------------------
            /*double scale = 1;
            double dconms = 20 ;
            double dconws = 11.28 ;
            double df = 42.7 ;
            double bd = 28.34 ;
            double dc = 31.984 ;
            double pl = 7.43 ;
            double lu = 17.53 ;
            double lcf = 24.65 ;
            double lpr = 38.79 ;
            double oal = 57.32  ;
            double lscws = 29.67 ;
            double lf_1 = 38.1 ;
            double ls = 18.53 ;
            */
            double scale = Convert.ToDouble(data["scale"]);
            double dconms = Convert.ToDouble(data["dconms"]) ;
            double dconws = Convert.ToDouble(data["dconws"]) ;
            double df = Convert.ToDouble(data["df"]) ;
            double bd = Convert.ToDouble(data["bd"]) ;
            double dc = Convert.ToDouble(data["dc"]) ;
            double pl = Convert.ToDouble(data["pl"]) ;
            double lu = Convert.ToDouble(data["lu"]) ;
            double lcf = Convert.ToDouble(data["lcf"]) ;
            double lpr = Convert.ToDouble(data["lpr"]) ;
            double oal = Convert.ToDouble(data["oal"]) ;
            double lscws = Convert.ToDouble(data["lscws"]) ;
            double lf_1 = Convert.ToDouble(data["lf_1"]) ;
            double ls = Convert.ToDouble(data["ls"]) ;
            
            double dy = pl * (0.64 / 7.43);//p1到三角缺的一部分
            double dy1 = dc * (1.31 / 31.984);//三角顶部bd与dc相减缺的一部分
            double dy2 = pl * (0.6353 / 7.43) ;//p7到p12的距离
            double dy3 = lpr * (3.13 / 38.79) ;//刀柄头厚度
            double xj = 57;//刀柄斜角
            double xj_ = xj * pi / 180;

            //点---------------------------------------------------------------------------------------------
            //第一部分
            //切削部分
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, oal);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1_1 = fun.Polar(p0, 0, dy);
            Vector2 p1 = fun.Polar(p1_1, pi / 2, dconws / 2.0);
            Vector2 p2 = fun.Polar(p1, pi, pl / 8.0);
            Vector2 p3 = fun.Polar(p2, 53 * pi / 180, (bd / 2.0 + dy1 - dconws / 2.0) / (Math.Sin(53 * pi / 180)));
            Vector2 p4 = fun.Polar(p3, -53 * pi / 180, fun.CalDistance(p2, p3));
            Vector2 p5 = fun.Polar(p1, 0, lscws - dy - (lscws / 31.0));
            Vector2 p6 = fun.Polar(p5, -pi / 4, (lscws / 31.0) / Math.Cos(pi / 4));
            Vector2 p7 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p9 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p10_1 = fun.Polar(p3, pi / -2, dy1);
            Vector2 p10_2 = fun.Polar(p10_1, 0, oal);
            Vector2 p10 = fun.Inters(p10_1, p10_2, p3, p4);
            Vector2 p11 = new Vector2(lcf, bd / 2.0);
            Vector2 p12 = fun.Polar(p7, pi, dy2);
            Vector2 p13_1 = fun.Polar(p0_1, pi / -2, dc - p3.Y);
            Vector2 p13_2 = fun.Polar(p13_1, pi, oal * 1.5);
            Vector2 p13 = fun.Inters(p13_1, p13_2, p12, fun.Polar(p12, -xj_, oal));
            Vector2 p14_1 = fun.Polar(p0_1, pi / -2, bd / 2.0);
            Vector2 p14_2 = fun.Polar(p14_1, pi, oal * 1.5);
            Vector2 p14 = fun.Inters(p14_1, p14_2, p7, fun.Polar(p7, -xj_, oal));
            Vector2 p15_1 = fun.Polar(p12, 0, lf_1);
            Vector2 p15_2 = fun.Polar(p15_1, pi / -2, oal);
            Vector2 p15 = fun.Inters(p15_1, p15_2, p14, fun.Polar(p14, 0, oal));
            Vector2 p16 = fun.Inters(p14, p15, p13, fun.Polar(p13, 61 * pi / 180, oal));
            Vector2 p17 = fun.Polar(p15_1, pi / 2, dconws);
            double fz1 = lf_1 - lscws - dy3;
            Vector2 p18 = fun.Polar(p17, pi - 10 * pi / 180, ((fz1 - fz1 / 3.0) / 3.0) / Math.Cos(20 * pi / 180));
            Vector2 p19 = fun.Polar(p18, pi + 10 * pi / 180, ((fz1 - fz1 / 3.0) / 3.0) / Math.Cos(20 * pi / 180));
            Vector2 p20 = fun.Polar(p19, pi - 10 * pi / 180, ((fz1 - fz1 / 3.0) / 3.0) / Math.Cos(20 * pi / 180));
            Vector2 p21 = p15_1;
            Vector2 p22 = fun.Polar(p15_1, pi / 2, dconws / 2.0 + df / 2.0);
            Vector2 p23 = fun.Polar(p22, 0, dy3);
            Vector2 p24 = fun.mirrorpoint(p22, p0_1, p0_2);
            Vector2 p25 = fun.mirrorpoint(p23, p0_1, p0_2);
            Vector2 p26_1 = fun.Polar(p23, pi / -2, fun.CalDistance(p23, p25) / 2.0);
            Vector2 p26 = fun.Polar(p26_1, pi / 2, dconms / 2.0);
            Vector2 p27 = fun.Polar(p26, 0, ls - ls / 8.0);
            Vector2 p28 = fun.Polar(p27, -pi / 4, (ls / 8.0) / Math.Cos(pi / 4));
            Vector2 p29 = fun.mirrorpoint(p26, p0_1, p0_2);
            Vector2 p30 = fun.mirrorpoint(p27, p0_1, p0_2);
            Vector2 p31 = fun.mirrorpoint(p28, p0_1, p0_2);
            Vector2 p32 = fun.Polar(p3, pi / -2, fun.CalDistance(p3, p4) / 4.0);
            Vector2 p33 = fun.Polar(p4, pi - 53 / 2 * pi / 180, fun.CalDistance(p3, p4) / 4.0);
            Vector2 p34 = fun.Polar(p2, 53 / 2 * pi / 180, fun.CalDistance(p3, p4) / 4.0);

            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p7, p8, p9, p6, p5, p8, p5, p2, p3, p10, p11, p4, p3);
            var polyline2 = Pus.AddPointsToLwPolyLine(p16, p14, p7, p12, p13, p16, p15, p17, p18, p19, p20, p5);
            var polyline3 = Pus.AddPointsToLwPolyLine(p26, p23, p22, p24, p25, p26, p27, p28, p31, p30, p27, p30, p29);
            var polyline4 = Pus.AddPointsToLwPolyLine(p5, p20, p19, p18, p17, p15, p14, p7, p8, p9, p6, p5);
            var polyline9 = Pus.AddPointsToLwPolyLine(p32, p33, p34, p32);
            polyline1.Vertexes[11].Bulge = -Math.Tan((86 * pi / 180) / 4);
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline4.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline4.Explode()[i].Type.ToString();    //将所有元素的类型记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline4.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline4.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 135, 10 * scale, hline1, harc1, hatching);
            void vis(Vector2 p, Vector2 pp)
            {
                oal = 43.72 * scale;
                Vector2 pp1 = fun.Polar(p, -pi / 2, (p.Y - pp.Y) / 2.0);
                Vector2 pp2 = fun.Polar(pp1, pi / 2, dconws / 2.0 + dconws / 8.0);
                Vector2 pp3 = fun.Polar(pp2, pi, oal);
                Vector2 pp4 = fun.mirrorpoint(pp2, p0_1, p0_2);
                Vector2 pp5 = fun.mirrorpoint(pp3, p0_1, p0_2);
                Vector2 pp6 = fun.Inters(pp2, pp3, p, fun.Polar(p, pi - pi / 4, oal));
                Vector2 pp7 = fun.Inters(pp4, pp5, pp, fun.Polar(pp, pi + pi / 4, oal));
                Vector2 pp8 = fun.Inters(pp6, pp7, p0_1, p0_2);
                Vector2 pp9 = fun.Polar(pp8, pi / 2, dconws / 6.0);
                Vector2 pp10 = fun.Polar(pp7, pi / 2, fun.CalDistance(pp8, pp9));
                Vector2 fk1 = fun.Polar(pp2, pi / 2, 0.1);
                Vector2 fk2 = fun.Polar(fk1, pi, oal);
                Vector2 fk3 = fun.mirrorpoint(fk1, p0_1, p0_2);
                Vector2 fk4 = fun.mirrorpoint(fk2, p0_1, p0_2);
                Vector2 pp11 = fun.Inters(p0_1, p0_2, pp9, fun.Polar(pp9, 44 * pi / 180, oal));
                Vector2 pp12 = fun.Inters(pp11, fun.Polar(pp11, -150 * pi / 180, oal), pp4, pp5);
                Vector2 pp13 = fun.Inters(p0_1, p0_2, pp6, fun.Polar(pp6, -156 * pi / 180, oal));
                Arc arc1 = fun.DrawArc5(pp6, new Line(fk1, fk2), pp13);
                Vector2 pp14 = fun.Inters1(pp12, fun.Polar(pp12, 50 * pi / 180, oal), arc1, 1);
                Vector2 pp15 = fun.Inters(pp14, fun.Polar(pp14, -81 * pi / 180, oal), pp12, fun.Polar(pp12, 39 * pi / 180, oal));
                Arc arc2 = fun.DrawArc5(pp12, new Line(fk3, fk4), pp11);
                Vector2 pp16 = fun.Inters1(pp7, fun.Polar(pp7, 173 * pi / 180, oal), arc2, 1);
                Arc arc3 = fun.DrawArc5(pp16, new Line(fk3, fk4), pp7);
                Vector2 pp18 = fun.Polar(pp1, pi, oal);
                Vector2 pp19 = fun.Inters(pp18, fun.Polar(pp18, 70 * pi / 180, oal), pp2, pp3);
                Vector2 pp20 = fun.Inters(pp18, fun.Polar(pp18, -70 * pi / 180, oal), pp4, pp5);
                Vector2 pp21 = fun.Inters(pp20, fun.Polar(pp20, 54 * pi / 180, oal), pp2, pp3);
                Vector2 pp22 = fun.Inters(pp20, fun.Polar(pp20, pi / 2, oal), pp21, fun.Polar(pp21, -140 * pi / 180, oal));
                Vector2 arc5_1 = fun.Polar(pp21, pi / 2, 0.1);
                Vector2 arc5_2 = fun.Polar(arc5_1, pi + 20 * pi / 180, oal);
                Arc arc5 = fun.DrawArc5(pp21, new Line(arc5_1, arc5_2), pp22);
                Vector2 pp23 = fun.Inters1(pp19, fun.Polar(pp19, -15 * pi / 180, oal), arc5, 0);
                Vector2 pp24 = fun.Inters(pp20, fun.Polar(pp20, pi / 6, oal), p0_1, p0_2);
                Vector2 pp25 = fun.Inters1(pp24, fun.Polar(pp24, 17 * pi / 180, oal), arc1, 0);
                Arc arc6 = fun.DrawArc5(pp20, new Line(fk3, fk4), pp24);
                Arc arc7 = fun.DrawArc5(pp25, new Line(fk1, fk2), pp24);
                Vector2 pp26 = fun.Inters(pp20, fun.Polar(pp20, 34 * pi / 180, oal), p0_1, p0_2);
                Vector2 pp27 = fun.Inters1(fun.Polar(pp21, pi / -2, 0.2 - 0.2326), fun.Polar(fun.Polar(pp21, pi / -2, 0.1), 0, oal), arc7, 0);
                Vector2 pp28 = fun.Inters1(pp13, fun.Polar(pp13, -161 * pi / 180, oal), arc6, 1);
                Arc arc4 = fun.DrawArc5(pp28, new Line(fk3, fk4), pp13);
                Vector2 pp17 = fun.Inters1(fun.Polar(pp12, pi / 2, 0.2 - 0.2326 + 0.06), fun.Polar(fun.Polar(pp12, pi / 2, 0.2 - 0.2326), 180 * pi / 180, oal), arc4, 1);

                var polyline5 = Pus.AddPointsToLwPolyLine(pp11, pp9, pp10, pp7, pp, p, pp6, pp9);
                polyline5.Vertexes[0].Bulge = -Math.Tan((47 * pi / 180) / 4);
                polyline5.Vertexes[1].Bulge = -Math.Tan((50 * pi / 180) / 4);
                var polyline6 = Pus.AddPointsToLwPolyLine(pp17, pp12, pp15, pp14);
                polyline6.Vertexes[1].Bulge = Math.Tan((81 * pi / 180) / 4);
                polyline6.Vertexes[2].Bulge = Math.Tan((35 * pi / 180) / 4);
                var polyline7 = Pus.AddPointsToLwPolyLine(pp22, pp18, pp19, pp23, pp19, pp18, pp20, pp22);
                polyline7.Vertexes[0].Bulge = -Math.Tan((44 * pi / 180) / 4);
                polyline7.Vertexes[2].Bulge = -Math.Tan((43 * pi / 180) / 4);
                polyline7.Vertexes[3].Bulge = Math.Tan((43 * pi / 180) / 4);
                var polyline8 = Pus.AddPointsToLwPolyLine(pp20, pp26, pp27, pp21);
                polyline8.Vertexes[0].Bulge = Math.Tan((57 * pi / 180) / 4);
                polyline8.Vertexes[1].Bulge = -Math.Tan((49 * pi / 180) / 4);
                LwPolyline[] n = { polyline5, polyline6, polyline7, polyline8 };
                Arc[] m = { arc1, arc2, arc3, arc4, arc5, arc6, arc7 };
                int i = 0;
                do
                {
                    if (i < 4)
                    {
                        n[i].Layer = additionalline;//Layer指图层
                        n[i].LinetypeScale = 5 * scale;//指线性比例
                        n[i].Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                        m[i].Layer = additionalline;//Layer指图层
                        m[i].LinetypeScale = 5 * scale;//指线性比例
                        m[i].Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                    }
                    else
                    {
                        m[i].Layer = additionalline;//Layer指图层
                        m[i].LinetypeScale = 5 * scale;//指线性比例
                        m[i].Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                    }
                    i++;
                } while (i < 7);

                dxf.AddEntity(new EntityObject[] {arc1 ,arc2,arc3 ,arc4 ,arc5 ,arc6,arc7
                ,polyline5 ,polyline6 ,polyline7 ,polyline8 ,polyline9
                });
            }
            vis(p2, p12);
            dxf.AddEntity(new EntityObject[] { polyline1,polyline2 ,polyline3
            });
            Line line1 = new Line(p0_1, p0_2);
            line1.Lineweight = Lineweight.W25;//Lineweight指线宽
            line1.Layer = centre;//Layer指图层
            line1.LinetypeScale = 5 * scale;//指线性比例
            line1.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line1); //提取
            //标注
            /* fun.dimrot1(dxf, p1, p18, 90, dc, 2, 2 * scale, 2.4 * scale, 0.9, "DCB", "", "");
       fun.jdbz2(dxf, new Line(p4, p5), new Line(p7, p8), dc, 2 * scale, 2.4 * scale, 0.9, "SIG", "", "");
       fun.Axis(dxf, fun.Polar(p0, pi + pi / 3, dc * 2), 180, -90, "Z", "X", "Y", 1 * scale, 2 * scale, 0);
       fun.Axis(dxf, p0, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
       fun.Axis(dxf, p19, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
       fun.Singlelinearrow(dxf, "CCMS", v1, 110, fun.Polar(v1, 110 * pi / 180, dc / 2.0), fun.Polar(v1, 110 * pi / 180, dc), 1.2 * scale, 1.6 * scale);
       Text txt1 = new Text("PCS", v18, 2.2 *scale , 0);
       Circle circle1 = new Circle(p0, 1.7 * 2 * scale) ;
             */
            Vector2 v1 = fun.Inters(p3, fun.Polar(p3, pi / -2, oal), p4, fun.Polar(p4, pi - 53 / 2 * pi / 180, oal));
            Vector2 v2 = fun.Polar(p26, 0, fun.CalDistance(p26, p27) / 6.0);
            Vector2 v3 = fun.Polar(p3, pi - pi / 4, dc * 1.3);
            Vector2 v4 = fun.Polar(p3, pi - pi / 4, 0.5 * 1.7 * scale);
            Vector2 v5 = fun.Polar(v4, pi - pi / 4, dc / 2.0);
            Vector2 v6 = fun.Polar(v1, pi - pi / 6, 0.5 * 1.7 * scale);
            Vector2 v7 = fun.Polar(v6, pi - pi / 6, dc);
            Vector2 v8 = fun.Polar(p1_1, pi + pi / 4, 0.5 * 1.7 * scale);
            Vector2 v9 = fun.Polar(v8, pi + pi / 4, dc * 1.2);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p14, pi / 2, bd / 5.0);
            Vector2 v12 = fun.Polar(v11, pi + pi / 3, 0.5 * 1.7 * scale);
            Vector2 v13 = fun.Polar(v12, pi + pi / 3, dc);
            Vector2 v14 = fun.Polar(v13, pi / -2, 1.2 * scale);
            Vector2 v15 = fun.Polar(p12, 0, pl / 5.0);
            Vector2 v16 = fun.Polar(p26_1, pi / -3, 0.5 * 1.7 * scale);
            Vector2 v17 = fun.Polar(v16, pi / -3, dconms / 1.2);
            Vector2 v18 = fun.Polar(v17, pi / -2, 1.2 * scale);


            fun.dimrot1(dxf, p3, p2, 0, dc / 2.0 - (p3.Y - p2.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "PL", "", "");
            fun.dimrot1(dxf, fun.Polar(p2, 0, lu), p2, 0, dc / 1.2 - (p2.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p5, p2, 0, dc - (p2.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF", "", "");
         //   fun.dimrot1(dxf, p23, p3, 0, dc * 1.2 - (p23.Y - p3.Y) / 2.0 - p3.Y, 2, 1.2 * scale, 1.6 * scale, 0.9, "LF_2,LTA_2", "", "");
            fun.dimrot1(dxf, p23, p2, 0, dc * 1.5 - (p23.Y - p2.Y) / 2.0 - p2.Y, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, p28, p2, 0, dc * 1.8 - (p28.Y - p2.Y) / 2.0 - p28.Y, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL", "", "");
         //   fun.dimrot1(dxf, p9, p12, 180, dc - (p12.Y - p9.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LSCWS", "", "");
            fun.dimrot1(dxf, p25, p9, 180, dc - (p25.Y - p9.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "ADJLN,ADJLX", "", "");
            fun.dimrot1(dxf, p25, p31, 180, dc - (p25.Y - p31.Y) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LS", "", "");
         //   fun.dimrot1(dxf, p10, p14, 90, oal + dc / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "BD", "", "");
            fun.dimrot1(dxf, p3, p13, 90, oal + dc, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC_1", "", "");
         //   fun.dimrot1(dxf, p22, p24, 90, oal + lpr + dc * 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DF", "", "");
            fun.dimrot1(dxf, p27, p30, -90, dc / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS", "", "");
         /*   fun.Axis(dxf, v1, 0, 90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, p26_1, 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, p1_1, 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, v11, 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 0);
            fun.Axis(dxf, fun.Polar(p31, pi / -4, dconms), 0, -90, "Z", "X", "Y", 0.5 * scale, 1.6 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v2, 80, fun.Polar(v2, 80 * pi / 180, dc / 4.0), fun.Polar(v2, 80 * pi / 180, dc / 2.0), 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v3, 180, fun.Polar(v3, 0 * pi / 180, dc / 4.0), fun.Polar(v3, 0 * pi / 180, dc / 2.0), 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "CCWS", v15, 225, fun.Polar(v15, 225 * pi / 180, dc / 2.0), fun.Polar(v15, 225 * pi / 180, dc), 1.2 * scale, 1.6 * scale);
         */ fun.jdbz2(dxf, new Line(p12, p13), new Line(p2, p3), dc / 1.5, 1.2 * scale, 1.6 * scale, 0.9, "SIG", "", "");
            Line linev1 = new Line(v4, v5);
            Line linev2 = new Line(v6, v7);
            Line linev3 = new Line(v8, v9);
            Line linev4 = new Line(v12, v13);
            Line linev5 = new Line(v17, v16);
            Text txt1 = new Text("CRP", v5, 1.2 * scale, 0);
            Text txt2 = new Text("CSW2_1", v7, 1.2 * scale, 0);
            Text txt3 = new Text("CSW1", v10, 1.2 * scale, 0);
            Text txt4 = new Text("CSW2_2", v14, 1.2 * scale, 0);
            Text txt5 = new Text("PCS,MCS", v18, 1.2 * scale, 0);
            Text txt6 = new Text("ISYC=306_09", fun.Polar(p6, pi / 2, dc * 2), 1.2 * scale, 0);

            Circle circle1 = new Circle(p3, 1.7 * 0.5 * scale);
            Circle circle2 = new Circle(v1, 1.7 * 0.5 * scale);
            Circle circle3 = new Circle(p1_1, 1.7 * 0.5 * scale);
            Circle circle4 = new Circle(v11, 1.7 * 0.5 * scale);
            /*
            dxf.AddEntity(new EntityObject[] { linev1 ,linev2 ,linev3,linev4,linev5
                ,txt1 ,txt2 ,txt3 ,txt4,txt5 ,txt6
                ,circle1 ,circle2 ,circle3 ,circle4

            });*/

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            //定义格式，根据路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }
}